import QtQuick
import QtQuick3D

import "../communication"
import "./viewPoints"
import "../common"
import "../items"

Node{
    Node {
        id: __materialLibrary__
    }

    property string curView

    property alias sceneCamera:sceneCamera

    property CameraPoints cameraPoints:CameraPoints{}
    property ItemPoints itemPoints:ItemPoints{}
    property PotionPoints potionPoints:PotionPoints{}

    Tracker{
        target: potionPoints.defaultPoint
        ItemFloat{
            Potion{
            }
        }

    }

    property alias playerGrid:playerGrid

    Tracker{
        target:itemPoints.tableCenter

        ItemGrid{
            id:playerGrid

            property real spacing:100/16 * 3
            xSpacing:spacing
            ySpacing:spacing
            zSpacing:spacing
            xNum:3
            yNum:1
            zNum:3
            source:Node{

            }

        }
    }

    property alias dealerGrid:dealerGrid

    Tracker{
        target:itemPoints.tableCenter

        ItemGrid{
            id:dealerGrid

            property real spacing:100/16 * 3
            xSpacing:spacing
            ySpacing:spacing
            zSpacing:spacing
            xNum:3
            yNum:1
            zNum:3
            source:Node{

            }

        }
    }

    PerspectiveCamera{
        id:sceneCamera

        property Node viewPoint:{
            var viewPoint = cameraPoints[curView]
            if(viewPoint === undefined)
                return null

            return viewPoint
        }

        property vector3d viewPos:viewPoint?Qt.vector3d(viewPoint.x,viewPoint.y,viewPoint.z):Qt.vector3d(0,0,0)

        x:viewPos.x
        y:viewPos.y
        z:viewPos.z

        eulerRotation: viewPoint?viewPoint.eulerRotation:Qt.vector3d(0,0,0)
        Behavior on x{
            NumberAnimation{

            }
        }

        Behavior on y{
            NumberAnimation{

            }
        }

        Behavior on z{
            NumberAnimation{

            }
        }

        Behavior on eulerRotation{
            Vector3dAnimation{

            }
        }

    }

    PlayTable{

    }

}
